<script type="text/javascript">
    var obj1=document.getElementById("id").value;
	$(function(){
		if(obj1 == 2){
		$('#{{datagrid_id}}').datagrid({
			
		    {% block datagrid_initialize %}
		    {% endblock %}

		    onLoadError: function() {
		    	$.jBox.tip('没有数据或根据搜索条件查不到相关数据', 'info');
		    	$("div.datagrid-body").css("height",0).find("table > tbody").empty();
		    	$("div.datagrid-view").css("height",'23px');
		    },
		    {% block datagrid_initialize11 %}
		    {% endblock %}

		   
           });
		}
		else{
			$('#{{datagrid_id}}').datagrid({
				
			    {% block datagrid_initialize22 %}
			    {% endblock %}
			    
			    onLoadError: function() {
			    	$.jBox.tip('没有数据或根据搜索条件查不到相关数据', 'info');
			    	$("div.datagrid-body").css("height",0).find("table > tbody").empty();
			    	$("div.datagrid-view").css("height",'23px');
			    }
			   
	           });
		}
 
		
		 	
        $('#{{datagrid_id}}s').searchbox({
            width:300,  
            searcher:function(value,name){
            	var result = $('#{{datagrid_id}}').datagrid('reload', {
        			query_key: name,
        			query_value: value
        		});
            },
            menu:'#{{datagrid_id}}mm',  
            prompt:'请输入搜索条件'  
        });
	});
	
	function message(cur){
        $.jBox("get:"+ cur.href,{
            title: "详细信息",
            width: 580,
            height: 380,
           top: '9%'
        });
        return false;
    } 
	
	
	function popUpEdit(cur){
	
  
	    $.jBox("get:"+ cur.href,{
	        title: "信息修改",
	        width: 580,
	        height: 380,
	        top: '9%',
	        buttons: {'提交': 1, '取消': 0 },
	        submit: function (v, h, f) {
	            if(v == 1){
	            var re = /^[-]?[0-9]+[\.]?[0-9]*$/;
	            var ide = /\d{17}[\d|X]|\d{15}/;
	            ratiovalue = $("#ratio").val();
	            balance = $("#balance").val();
	      
	            identi = $("#identify").val();
	         
	            if(!re.test(ratiovalue) || parseFloat(ratiovalue)>=1.0 || parseFloat(ratiovalue)<0.0){
		             $.jBox.tip('提成点数输入不合法', 'error');
		             return false;
	             }
	            if(!re.test(balance)  || parseFloat(balance)<0.0){
		             $.jBox.tip('余额输入不合法', 'error');
		             return false;
	            }
	            if(!ide.test(identi)){
		             $.jBox.tip('身份证输入不合法', 'error');
		             return false;
	             }
	             

	            if($('#{{datagrid_id}}_form').form('validate')){
	                    $.ajax({
	                        type: 'POST',
	                        async: false,
	                        url: '/lottery/accounts/submit_edit',
	                        data: $('#{{datagrid_id}}_form').serialize(),
	                        success:function(data){
	                        	$('#{{datagrid_id}}').datagrid('reload');
	                        	$.jBox.tip('更新成功', 'success');
	                        },
	                        error:function (req, status, error){
	                        	$.jBox.tip(' ' + req.responseText, 'error');
	                        }
	                    });
	                    return true;
	                }
	                return false;
	            }
	            return true;
	        }
	    });

	    return false;

	}

	{% block myscript %}
	{% endblock %}
</script>

    
<div style="padding:20px;overflow:hidden;" class="ajust_height">
	<div style="padding-bottom:20px;overflow:hidden;">
		<input id="{{datagrid_id}}s"></input>
		<div id="{{datagrid_id}}mm" style="width:120px">
			{% block search_menu %}
			{% endblock %}
		</div>
	</div>
	<table id="{{datagrid_id}}" url="/lottery/accounts/data" striped="true"
		pagination="true" iconCls="icon-save" url="" fitColumns="true" singleSelect="false"
		rownumbers="true" pageSize="15"   pageList=" [5,10,15,20,25]">
		<input type="hidden" id="id" value="{{account.accountType}}">

	</table>
	
</div>

